<?php slot('header')?>
<style type="text/css">
.p-more{
	padding: 0px 0px;
	background: #F7EEDD;
}
</style>
<script type="text/javascript">
$(function(){
	MAIN.setMenu('m-product');
	FORM.init();
	$('div#hz-multi-menu-sub').css('margin-left',(parseInt(($('div#hz-multi-menu-sub').width()-101)/2,10)*-1) + 'px');
	$('ul.scroll').scrollend({
		over: 10,
		callback: function($ob){
			if(parseInt($ob.attr('data-load'),10) == 0){
				LOADING.hide();
				$ob.unbind('scroll');
				return;
			}
			if(LOADING.isLoading) return;
			LOADING.show();
			$.ajax({
				type: 'POST',
				url: $ob.attr('data-url'),
				data: {
					id: $ob.attr('data-id'),
					page: $ob.attr('data-page')
				},
				cache: false,
				success: function(data){
					LOADING.hide();
					if(data == '' || parseInt(data,10) == 0){
						$ob.attr('data-load', '0');
						$ob.unbind('scroll');
					}
					$ob.attr('data-page', parseInt($ob.attr('data-page'), 10) + 1);
					$ob.append(data);
					MAIN.reInit();
				}
			});
		}
	});
});
function onSent(data){
	
	$data = $.parseJSON(data);
	if(parseInt($data.status,10) == 1){
		ERROR.clear();
		ERROR.add($data.message);
		ERROR.showSuccess();
		$('#cmFullName').attr('readonly',true);
		$('#cmComment').attr('readonly',true);
		$('#cmCaptcha').attr('readonly',true);
	}else{
		ERROR.clear();
		ERROR.add($data.message);
		ERROR.show();
		$('#cmCaptcha').val('');
		$('img.captcha').trigger('click');
	}
}
</script>

<?php end_slot()?>
<?php slot('rhead')?>
<?php include_component('componentUlti', 'slide')?>
<?php end_slot()?>
<div class="hline" style="border-top: 2px solid #fff"></div>
<div class="logo-none-slogan product" id="hz-multi-menu-parent" style="text-align: center">
	<img src="/css/daiviet/img/plus.png" class="hz-multi-menu" data-id-sub="hz-multi-menu-sub" data-id-parent="hz-multi-menu-parent"/>
	<div id="hz-multi-menu-sub" class="hz-multi-menu-sub">
		<ul id="product-cate-id" class="hz-multi-menu-sub">
			<?php foreach($data['cates'] as $cate):?>
			<li><a href="<?php echo url_for2('product_cate', array('cate_name' => UserStringHelper::titleToAddress($cate['name']),'cate_id' => $cate['id']))?>"><?php echo $cate['name']?></a></li>
			<?php endforeach;?>
		</ul>
	</div>
</div>
<div class="hz-clr"></div>
<div class="p-title product"><div class="product-cate"><?php echo $data['product']['cate_name']?></div></div>
<div class="p-info">
	<div class="img">
		<img src="<?php echo $data['product']['photo_url']?>"/>
	</div>
	<div class="info">
		<div class="p-title-detail border-bottom"><?php echo $data['product']['name']?></div>
		<label>Nhà sản xuất:</label><span class="manu"><?php echo $data['product']['manu_name']?></span><br/>
		<label>Mã sản phẩm:</label><span class="code"><?php echo $data['product']['code']?></span><br/>
		<label>Tình trạng:</label><span><?php echo Products::getStatusByProduct($data['product'])?'Còn hàng': 'Tạm thời hết hàng'?></span>
		<div class="border-bottom"></div>
		<div class="box-price">
			<span>Giá bán:</span><br/>
			<div class="cd">
				<input type="radio" name="pr-select"/>
				<div>
					<span>Phiên bản đĩa CD</span><br/>
					<span class="price money-show"><?php echo $data['product']['price']?></span>
				</div>
				
			</div>
			<div class="down">
				<input type="radio" checked name="pr-select"/>
				<div>
					<span>Phiên bản Download</span><br/>
					<span class="price money-show"><?php echo $data['product']['price']?></span>
				</div>
			</div>
			<div class="hz-clr"></div>
		</div>
		<div class="addtocart">
			<label>Số lượng:</label> 
			<input type="number" min="1" value="1" name="pr-quantity"/>
			<img src="/css/daiviet/img/vi/addtocart.png"/>
			<img src="/css/daiviet/img/vi/addtofavorie.png"/>
		</div>
		<div class="border-bottom"></div>
		<div class="comment">
			<label style="float: left">Đánh giá:</label><div class="start-bound"><div class="star-rating-readonly" data-readonly="1" data-phpPath=""  data-average="<?php echo $data['product']['rating']['rating_point']?>" data-id="-1"></div></div><label>Nhận xét:</label> <?php echo $data['product']['rating']['total']?> <a href="#">Viết nhận xét của bạn</a>
			<div class="hz-clr"></div>
		</div>
	</div>
	
	<div class="hz-clr"></div>
	<div class="p-content content-padding">
		<div class="p-title"><span class="product-sub">Mô tả sản phẩm</span></div>
		<div>
			<?php echo html_entity_decode(nl2br($data['product']['content']))?>
			<div class="hz-clr"></div>
		</div>
	</div>
	<?php if(!empty($data['product']['video_url'])):?>
	<div class="hz-clr"></div>
	<div class="p-content content-padding">
		<div class="p-title"><span class="product-sub">Xem trước Video</span></div>
		<div class="p-video">
			<div id="hz-trailer" class="hz-video" data-video-url="<?php echo html_entity_decode($data['product']['video_url'])?>" data-photo-url="<?php echo $data['product']['photo_url']?>" data-width="480" data-height="320"></div>
			<div class="hz-clr"></div>
		</div>
	</div>
	<?php endif?>
	<div class="hz-clr"></div>
	<div class="p-content content-padding">
		<div class="p-title"><span class="product-sub">Đánh giá - Nhận xét</span></div>
		<div class="comment" id="divCommtent">
			<div class="comment-left">
				<div class="title">Đánh giá của bạn</div>
				
				<form id="fComment" method="post" class="form-vertical">
					<div>
						<label class="required">Họ tên của bạn</label><br/>
						<input type="text" data-error="Tên của bạn ?" name="cmFullName" value="" class="hz-required" id="cmFullName"/>
						<input type="hidden" name="cmRating"  data-error="Theo bạn, sản phẩm được bao nhiêu điểm ?" class="hz-checking" value="0" id="cmRating"/>
						<input type="hidden" name="cmProductID" class="hz-checking" value="<?php echo $data['product']['id']?>" id="cmProductID"/>
						
					</div>
					<div>
						<label class="required">Đánh giá của bạn</label><br/>
						<textarea data-error="Nhận xét của bạn ?" rows="6" cols="6" class="hz-required" name="cmComment" id="cmComment"></textarea>
					</div>
					<div>
						<label class="required">Mã bảo vệ</label><br/>
						<input style="width: 140px;" type="text" placeholder="Nhập ký tự ở hình bên" data-error="Bạn hãy nhập mã bảo vệ !" name="cmCaptcha" value="" class="number hz-required captcha" id="cmCaptcha"/>
						<img title="Click vào đây để thay đổi mã bảo vệ" class="captcha" />
					</div>
					<div>
						<label style="float:left;margin-top: 3px;">Bình chọn:</label><div class="start-bound">
						<div id="select-rating" class="star-rating" data-readonly="0" data-phpPath=""  data-average="10" data-id="-1" data-refer-id="cmRating"></div></div>
						<img style="float: right;margin-right: 10px;cursor: pointer" src="/css/daiviet/img/vi/comment.png" class="hz-submit-ajax" data-form-id="fComment" data-url="<?php echo url_for2('product_rating')?>" callback-before-send="checkRating" callback-after-success="onSent"/>
						<div class="hz-clr"></div>
					</div>
				</form>
			</div>
			<div class="comment-right">
				<div class="title">Đánh giá hiện có</div>
				<ul class="scroll" data-id="<?php echo $data['product']['id']?>" data-url="<?php echo url_for2('product_comment')?>" data-page="2" data-load="<?php echo count($data['product_comments']) < intval(sfConfig::get('app_product_detail_comment_scroll')) ? '0' : '1'?>">
					<?php foreach($data['product_comments'] as $comment):?>
					<li>
						<div class="name"><?php echo $comment['full_name']?></div>
						<div class="star-rating-readonly" data-readonly="1" data-phpPath=""  data-average="<?php echo $comment['rating_point']?>" data-id="-1"></div>
						<div class="content"><?php echo html_entity_decode(nl2br($comment['content']))?></div>
					</li>
					<?php endforeach;?>
				</ul>
			</div>
			<div class="hz-clr"></div>
		</div>
	</div>
</div>
<div class="hz-clr"></div>
<div class="p-more">
	<div class="p-title"><span class="product-sub">Hướng dẫn mua sản phầm phần mềm Đại Việt</span></div>
	<div class="content-padding"><?php echo (SysPages::getContent(SysPages::PRODUCT_NOTE))?></div>
	<div class="hz-clr"></div>
</div>



	
		
